<script type='text/javascript'>
<?php 
    if (isset($msg) && ($msg == "erro")):
 ?>
    jQuery.ajax({
        url: '<?php echo Mapper::url('/usuario/erroEditar'); ?>',
        type: 'POST',
        data: '<?php echo "id=".$objUsua->usua_id; ?>',
        success: function(r) {
            jQuery('.modal').remove();
            jQuery('body').append(r);
        }
    });
<?php endif; ?>  
</script>
<?php echo $html->script('validar'); ?>
<div class="wrapper">
    <div class="mainTitle envelope tMargin-2 left">
        <h2 class="bMargin-1">Dashboard - Leads</h2>
        <h3>Leads controlados em tempo real</h3>
    </div>
    <div class="clear"></div>
    <hr />
    <div class="leadsCtn">
        <div class="title">
            <h4 class="left">Editar usuário</h4>
        </div>
        <div class="content ">                    
            <form method="post" action="<?php echo Mapper::url( '/usuario/editar/'.$objUsua->usua_id ); ?>">
                <fieldset>
                    <ul class="form vhh a tMargin-2 bMargin-2 left">
                        <li>
                            <label for="">Login:</label>
                            <input type="text" name="usua_chave" value="<?php echo $objUsua->usua_chave; ?>" class="required" label="Login" />
                        </li>
                        <li>
                            <label for="">Nome:</label>
                            <input type="text" name="usua_nome" value="<?php echo $objUsua->usua_nome; ?>" class="required" label="Nome"/>
                        </li>
                        <li>
                            <label for="">Tipo:</label>
                            <select name="usua_perm">
                                <option value="0"<?php echo ( $objUsua->usua_perm == 0) ? ' selected="selected"' : ''; ?>>Normal</option>
                                <option value="1"<?php echo ( $objUsua->usua_perm == 1) ? ' selected="selected"' : ''; ?>>Administrador</option>
                                <?php if($ehMaster) { ?>
                                    <option value="2"<?php echo ( $objUsua->usua_perm == 2) ? ' selected="selected"' : ''; ?>>Master</option>
                                <?php } ?>
                            </select>
                        </li>
                    </ul>
                    <ul class="form vhh b tMargin-2 bMargin-2 right">
                        <li>
                            <label for="">Email:</label>
                            <input type="text" name="usua_email" value="<?php echo $objUsua->usua_email; ?>" class="email" label="E-mail"/>
                        </li>
                        <li>
                            <label for="">Senha:</label>
                            <input type="text" name="usua_senha" />
                        </li>
                        <?php if($ehMaster) { ?>
                            <li>
                                <label for="">Cliente:</label>
                                <select name="clie_id">
                                    <option value="0">-</option>
                                    <?php foreach($arrCliente as $current) { ?>
                                        <option value="<?php echo $current['clie_id'] ?>"<?php echo ( $objUsua->clie_id == $current['clie_id']) ? ' selected="selected"' : ''; ?>><?php echo $current['clie_empresa'] ?></option>
                                    <?php } ?>
                                </select>
                            </li>
                        <?php } ?>
                    </ul>
                </fieldset>
                <input type="submit" class="botaoCinza right" value="Salvar">
                <div class="clear"></div>
            </form>
        </div><!-- .content -->
    </div><!-- .leads -->
</div><!-- .wraper -->